<div class="row">
	<div class="col-md-12">
		<a class="btn btn-danger btn-sm" role="button" data-toggle="collapse" href="#filter" aria-expanded="false" aria-controls="filter" style="margin-bottom: 10px;">
			筛选
			<i class="icon-double-angle-down icon-large"></i>
		</a>
		<div class="btn btn-success btn-sm" style="margin-bottom: 10px;" onclick="$.suredy.loadContent('${request.contextPath}/dm');">返回</div>
		<div class="collapse" id="filter">
			<div class="row">
				<form class="filter-form" action="${request.contextPath}/dm/op-logs" method="post">
					<div class="col-md-4">
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									<div style="width: 60px;">日志类型</div>
								</div>
								<select class="form-control input-sm" name="type">
									<option value=""></option>
									<#if types??> <#list types as t>
									<option value="${t}" ${((search.type==t)?string('selected',''))!''}>${t.value}</option>
									</#list> </#if>
								</select>
							</div>
						</div>
					</div>
					<div class="col-md-4">
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									<div style="width: 60px;">操作人员</div>
								</div>
								<input type="text" class="form-control input-sm" name="operator" value="${search.operator}" />
							</div>
						</div>
					</div>
					<div class="col-md-4">
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									<div style="width: 60px;">日期范围</div>
								</div>
								<input type="text" class="form-control input-sm datetimepicker" data-format="yyyy-MM-dd HH:mm" data-time="${(search.start?string('yyyy-MM=dd HH:mm'))!''}" name="start" readonly="readonly" />
								<div class="input-group-addon" style="border-width: 1px 0;">至</div>
								<input type="text" class="form-control input-sm datetimepicker" data-format="yyyy-MM-dd HH:mm" data-time="${(search.end?string('yyyy-MM=dd HH:mm'))!''}" name="end" readonly="readonly" />
							</div>
						</div>
					</div>
					<div class="col-md-12">
						<div class="btn btn-danger btn-sm filter-search">查询</div>
						<div class="btn btn-default btn-sm filter-reset">重置</div>
					</div>
					<div class="col-md-12">&nbsp;</div>
				</form>
			</div>
		</div>
	</div>
</div>

<div class="dm-op-logs">
	<table class="op-logs" data-page="${page}" data-page-size="${pageSize}" data-count="${count}">
		<tr class="title-row">
			<th class="text-center" width="50">序号</th>
			<th class="text-center">人员</th>
			<th class="text-center">时间</th>
			<th class="text-center">日志类型</th>
			<th class="">操作内容</th>
		</tr>
		<#if data??> <#list data as d>
		<tr class="data">
			<td class="text-center">${d_index+1}</td>
			<td class="text-center">${d.operator}</td>
			<td class="text-center">${(d.time?string('yyyy-MM-dd'))!''}</td>
			<td class="text-center">${d.type.value}</td>
			<td class="" style="padding: 0 0 0 8px;">
				<div style="max-height: 90px; overflow: auto;">
					<#if d.logs??> <#list d.logs?split('\n') as l> ${l}
					<br>
					</#list> </#if>
				</div>
			</td>
		</tr>
		</#list> </#if>
	</table>
</div>

<script src="${request.contextPath}/js/suredy-datetimepicker.js"></script>
<script src="${request.contextPath}/js/suredy-list.js"></script>
<script type="text/javascript">
	$(function() {
		$.suredy.datetimepicker.init();

		var doSearch = function(page, pageSize) {
			var form = $('form.filter-form');

			form.ajaxSubmit({
				dataType : 'html',
				data : {
					page : page,
					pageSize : pageSize
				},
				success : function(html, textStatus, jqXHR) {
					if (!html)
						return false;

					$('div.suredy-content').html(html);
				},
				error : function(jqXHR, textStatus, errorThrown) {
					return false;
				}
			});
		};

		$('.op-logs').list({
			header : false,
			paginate : function(page, pageSize, key) {
				doSearch(page, pageSize);
			},
		});

		$('.filter-search').on('click', function() {
			doSearch(1, $('table.op-logs').data('page-size'));
		});

		$('.filter-reset').on('click', function() {
			$('form.filter-form input').val('');
			$('form.filter-form option:first-child').prop('selected', true);
		});
	});
</script>